.h
files and .c
files..h
file must begin and end as follows:
#ifndef name_h #define name_h #endifwhere name is the name of the file.
makefile
that contains
all dependencies and can be used to build the project.
static char * concat(char *start, char *end) { }
struct
and enum
types,
put brackets in column 1 unless the whole contents fits on
one line.if (x > 0) { // } else { // } }
enum
constants).Every file must include the following comment at/near the top (which, of course, must be true).
// This work complies with the JMU Honor Code.
General descriptive comments (i.e., that would be of use to
someone using your code) should be in the .h
file
(since that is the file that will always be available. Comments
about internal details/workings should be in the .c
file.
void
parameter list, not an empty parameter list.
strlen()
, strcpy()
or strcat()
, use strnlen()
,
strncpy()
or strncat()
instead.
gets()
, use fgets()
or
getchar()
instead.
-pedantic
|
Issue all warnings demanded by strict ISO |
-pedantic-errors
|
Generate an error (rather than a warning) whenever the base standard requires a message |
-Wall
|
Enable all warnings about "questionable" constructs |
-std=c99
|
Set the base standard to ISO C99 |
Some people prefer the C90 standard (which is equivalent to using
-ansi
) to the C99 standard. Unfortunately, the C90
standard prohibits the use of //
comments.
Ranade,
J.
and
A. Nash
(1992)
The Elements of C Programming Style, McGraw Hill
, Boston.
(Order from
amazon
, order from
Barnes and Noble
, compare at
bigwords
, compare at
CampusBooks4Less
, order from
Chegg
, or search
eFollett
)
Copyright 2019